﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Hired
{
    public partial class qna : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<object> generalQuestions = DBQuestion.RetrieveTopQuestionsByCategory("General");
            gvGeneral.DataSource = generalQuestions.Take(3);
            gvGeneral.DataBind();

            List<object> accountingQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Accounting");
            gvAccounting.DataSource = accountingQuestions.Take(3);
            gvAccounting.DataBind();

            List<object> administrationQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Administration");
            gvAdministration.DataSource = administrationQuestions.Take(3);
            gvAdministration.DataBind();

            List<object> salesAndMarketingQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Sales & Marketing");
            gvSalesAndMarketing.DataSource = salesAndMarketingQuestions.Take(3);
            gvSalesAndMarketing.DataBind();

            List<object> manufacturingQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Manufacturing");
            gvManufacturing.DataSource = manufacturingQuestions.Take(3);
            gvManufacturing.DataBind();

            List<object> artsMediaAndCommunicationQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Arts, Media & Communication");
            gvArtsMediaAndCommunications.DataSource = artsMediaAndCommunicationQuestions.Take(3);
            gvArtsMediaAndCommunications.DataBind();

            List<object> constructionQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Construction");
            gvConstruction.DataSource = constructionQuestions.Take(3);
            gvConstruction.DataBind();

            List<object> servicesQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Services");
            gvServices.DataSource = servicesQuestions.Take(3);
            gvServices.DataBind();

            List<object> hotelsAndRestaurantsQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Hotels & Restaurants");
            gvHotelsAndRestaurants.DataSource = hotelsAndRestaurantsQuestions.Take(3);
            gvHotelsAndRestaurants.DataBind();

            List<object> sciencesQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Sciences");
            gvSciences.DataSource = sciencesQuestions.Take(3);
            gvSciences.DataBind();

            List<object> educationQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Education");
            gvEducation.DataSource = educationQuestions.Take(3);
            gvEducation.DataBind();

            List<object> healthcareQuestions = DBQuestion.RetrieveTopQuestionsByCategory("Healthcare");
            gvHealthcare.DataSource = healthcareQuestions.Take(3);
            gvHealthcare.DataBind();
        }

        protected void btnAsk_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("askquestion.aspx?title=" + Server.UrlEncode(txtAskQuestion.Text));
        }
    }
}